<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>金字塔图案</title>
		<style>
			*{
				font-family:cursive;
			}
		</style>
	</head>
	<body>
		<script>
			var num = prompt("请输入数字");
			for(i = 0; i < num; i++) {
				var nbsp = num-i-1;
				for(k = 0; k < nbsp; k++) {
					document.write("&nbsp");
				}
				var star = (i + 1) * 2-1;
				for(j = 0; j < star; j++) {

					document.write("*");
				}

				document.write("<br>");
			}
		</script>
	</body>

</html>